<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客车咨询记录列表</title>
<jsp:include page="../import.jsp" flush="true" />

<body class="iframeBody">
<div class="Wrapper">
<div id="pageInTab" class="pageInTab">
<div tabid="tabA" title="客车咨询记录列表" lselected="true">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
            <div class="fieldBox" id="searchPrjTypCdId">
                <div class="label">行业</div>
                <div class="field">
                    <select name="profession"  id="profession" >
                        <option value="  " selected="selected">--请选择--</option>
                        <c:forEach items="${professionList}" var="opt">
                            <option value="${opt.value}">${opt.value}</option>
                        </c:forEach>
                    </select>
                </div>
            </div>
           <div class="fieldBox" id="searchCstNmId">
                <div class="label">客户姓名</div>
                <div class="field">
                    <input name="name" id="name" type="text" class="ui-textbox" value="">
                </div>
            </div>
           <div class="fieldBox" id="searchCntTypCdId">
            <div class="label">所在省份</div>
               <div class="field">
                 <select name="prNm"  id="prNm"  >
                  <option value="  " selected="selected">--请选择--</option>
                    <c:forEach items="${provinceList}" var="opt">
                     <option value="${opt.value}">${opt.value}</option>
                    </c:forEach>
               </select>
               </div>
            </div>
         <div class="fieldBox" id="searchBizTypCdId">
            <div class="label">区域</div>
               <div class="field">
                 <select name="areaNm"  id="areaNm"  >
                  <option value="  " selected="selected">--请选择--</option>
                <c:forEach items="${areaList}" var="opt">
                 <option value="${opt.value}">${opt.value}</option>
                </c:forEach>
               </select>
               </div>
            </div>
            <div class="fieldBox col_33" >
                <div class="label">咨询时间</div>
                <div class="field">
                     <input name="crtTm" id="crtTm" type="text" class="ui-datepicker" value="">
                     <%--<span>---</span>
                      <input name="endDt" id="endDt" type="text" class="ui-datepicker" value="">--%>
                </div>
            </div>
            <div class="clearFix"></div>
            <div class="btnsBox">
               <span id="searchBtn"  class="sq-button sq-button-round">查询</span>
               <span id="clearBtn" onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
                <span id="exportBtn" onclick="exportExcel();" class="sq-button sq-button-round">导出</span>
            </div>
        </div>
    </form>
</div>

<div id="ligergrid1" class="sq-grid"></div> 
</div>
</div>
</div>


<script type="text/javascript">
    var professionList = '${professionList}';
    var areaList = '${areaList}';
    var provinceList = '${provinceList}';
    console.log(professionList);
    console.log(areaList);
    console.log(provinceList);

	$(function () {

	    $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/bus/prjprdquat/initConsultRecordList.do',
	    	method : 'get',
	    	parms:{
	    	},
	    	
	        columns: [
	             { display: '客户名称', name: 'name',minWidth: 140 ,enabledSort:true},
	             { display: '手机号码', name: 'phone', minWidth: 140 , enabledSort:true},
	            { display: '所在省市', name: 'prNm', minWidth: 140,align:'center', enabledSort:true},
	            { display: '区域', name: 'areaNm', minWidth: 140,align:'center', enabledSort:true},
	            { display: '车辆意向品牌', name: 'intensionBrand', width: 100 , enabledSort:true},
	            { display: '行业', name: 'profession', width: 100 , enabledSort:true},
	            { display: '融资总额', name: 'actLsAmt', width: 100 , enabledSort:true},
	            { display: '保证金比例', name: 'depositPct', width: 150, enabledSort:true},
	            { display: '融资期限', name: 'lsPd', minWidth: 140 , enabledSort:true},
	            {display: '还款方式', name: 'repayWay', minWidth: 100 , enabledSort:true},
	            { display: '年利率', name: 'annIntRatePct', minWidth: 150 , enabledSort:true},
	             { display: 'IRR', name: 'irrPct', minWidth: 140 , enabledSort:true},
	            { display: '每期月还', name: 'eachEstRntAmtStr', minWidth: 100 , enabledSort:true},
	            { display: '报价时间', name: 'mdfTm', minWidth: 100 , render:renderDate, enabledSort:true},
	            { display: '创建时间', name: 'crtTm', minWidth: 100 , render:renderDate, enabledSort:true},
	            { display: '是否在线咨询', name: 'isOnlionConsultStr', minWidth: 100 , enabledSort:true,},
	            { display: '在线咨询次数', name: 'consultTimes', minWidth: 100 , enabledSort:true,},
	            { display: '客户经理', name: 'managerNm', minWidth: 100 , enabledSort:true},
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-20,
	        //isScroll: false,
	        checkbox:true,
	        delayLoad:true,
	        rownumbers:true,
	        /* isSingleCheck:true,
	        onSelectRow: function(rowdata, rowid, rowobj){
				$("#projectId").val(rowdata.id);
			},
			onUnSelectRow : function(rowdata, rowid, rowobj){
				$("#projectId").val('');
			},
			onAfterShowData : function () {
	        	SetIframe_height();
	        } */
	    });
	 //   initOrgTree();
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         data["crtTm"] = $("#crtTm").val();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	
	    var form = new liger.get("searchBar");
        var data = form.getData();
        data["crtTm"] = $("#crtTm").val();
        for (name in data){
           grid.setParm(name,data[name]);
        };
        grid.reload();
	    $("#pageloading").hide();
	});

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

    function clearBtn() {
        $("#searchBar").ligerForm();
        var form = new liger.get("searchBar");
        form.setData({
            profession: " ",
            name: " ",
            prNm: " ",
            areaNm: " ",
            crtTm: " ",
        });
    }

    //导出
    function exportExcel(){
        var form = liger.get("searchBar");
        var data = form.getData();
        var wait_dialog;
        $.ajax({
            type: 'get',
            dataType:'json',
            url: '<%=path%>/bus/prjprdquat/exportBusConsultList.do',
            data:data,
            beforeSend:function(){
                wait_dialog=$.ligerDialog.SQalert({content: '正在导出...',SQ_type: "waitting"});
            },
            success:function(msg){
                wait_dialog.close();
                if(msg.success == 1){
                    window.open(msg.data);
                }else{
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            }
        });
    }
	    

</script>

</body>
</html>